#include <fstream>
#include <stdexcept>

#include "calculator.h"

int main() {
   std::ifstream input("in.txt");
   std::ofstream output("out.txt");
   
   std::string str;
   
   while (std::getline(input, str))
   {
      if (str.empty())
      {
         continue;
      }
      
      try
      {
         output << evaluate(str) << "\n";
      }
      catch (...)
      {
         output << "<error>\n";
      }
   }
   
   return 0;
}

